 var baseUrl="";
 // baseUrl="http://192.168.3.88";

var mapStyle={style: 'midnight'};

function getSearchParams(){
    var url = location.search;//这一条语句获取了包括问号开始到参数的最后，不包括前面的路径
	var params = url.substr(1);//去掉问号
	var pa = params.split("&");
	var s = new Object();
	for(var i = 0; i < pa.length; i ++){
		s[pa[i].split("=")[0]] = decodeURI(pa[i].split("=")[1]);
	}
	return s;
}



function getOptions(mvtype,zbtype){
    let options= {};
    if(mvtype==2){
        options.draw = 'choropleth';
        options.size = 2;
        // if(zbtype==2){
        //     options.splitList= [
        //         {start: 44, end: 85, value: '#00ff06'},
        //         {start: 85, end: 95, value: '#29e7f8'},
        //         {start: 95, end: 105, value: '#f6ff00'},
        //         {start: 105, end: 120, value: '#ff8a00'},
        //         {start: 120, end: 140, value: '#ff0600'},
        //     ]				
        // }
        // if(zbtype==3){
        //     options.splitList= [
        //         {start: 3, end: 7, value: '#00ff06'},
        //         {start: 7, end: 10, value: '#29e7f8'},
        //         {start: 10, end: 13, value: '#f6ff00'},
        //         {start: 13, end: 15, value: '#ff8a00'},
        //         {start: 15, end: 20, value: '#ff0600'},
        //     ]
        // }
        // if(zbtype==1){
        //     options.splitList= [
        //         {start: 0, end: 2, value: '#00ff06'}
        //     ]
        // }
        // return options;
    }

    
    if(mvtype==5){
        options.draw = 'heatmap';
        options.size = 6;
        if(zbtype==1){
            options.max= 2;
        }
		// options.gradient = { 0.25: "rgb(0,0,255)", 0.55: "rgb(0,255,0)", 0.85: "yellow", 1.0: "rgb(255,0,0)"};
    }
    if(mvtype==4){
        options.draw = 'honeycomb';
        options.fillStyle ='rgba(55, 50, 250, 0.8)';
        options.shadowColor='rgba(255, 250, 50, 1)';
        options.shadowBlur= 20;
        options.size= 50;
        options.label= {
			show: true,
			fillStyle: 'white',
		};
        options.globalAlpha= 0.5;
    }
    if(mvtype==3){
        options.draw = 'grid';
        options.fillStyle ='rgba(55, 50, 250, 0.8)';
        options.shadowColor='rgba(255, 250, 50, 1)';
        options.shadowBlur= 20,
        options.size = 40;
        options.globalAlpha= 0.5,
        options.label={ 
			show: true,
			fillStyle: 'white',		
		}
    }
    if(zbtype==2){
        options.min= 40;
        options.max= 140;
        options.gradient=  { 0.45: "#00ff06",0.55: "#29e7f8", 0.65: "#f6ff00", 0.8: "#ff8a00", 1.0: "#ff0600"};
        options.splitList= [
            {start: 44, end: 85, value: '#00ff06'},
            {start: 85, end: 95, value: '#29e7f8'},
            {start: 95, end: 105, value: '#f6ff00'},
            {start: 105, end: 120, value: '#ff8a00'},
            {start: 120, end: 140, value: '#ff0600'},
        ]
    }
    if(zbtype==3){
        options.min= 3;
        options.max= 19;
        options.gradient= { 0.25: "#00ff06",0.4375: "#29e7f8", 0.625: "#f6ff00", 0.75: "#ff8a00", 1.0: "#ff0600"};
        options.splitList= [
            {start: 3, end: 7, value: '#00ff06'},
            {start: 7, end: 10, value: '#29e7f8'},
            {start: 10, end: 13, value: '#f6ff00'},
            {start: 13, end: 15, value: '#ff8a00'},
            {start: 15, end: 20, value: '#ff0600'},
        ]
    }
    if(zbtype==1){
        options.splitList= [
            {start: 0, end: 2, value: '#00ff06'}
        ]
    }
    return options;
}

// function getSplitList(zbtype){
//     if(zbtype==2){
//         return [
//             {start: 44, end: 85, value: '#00ff06'},
//             {start: 85, end: 95, value: '#29e7f8'},
//             {start: 95, end: 105, value: '#f6ff00'},
//             {start: 105, end: 120, value: '#ff8a00'},
//             {start: 120, end: 140, value: '#ff0600'},
//         ]				
//     }
//     if(zbtype==3){
//         return [
//             {start: 3, end: 7, value: '#00ff06'},
//             {start: 7, end: 10, value: '#29e7f8'},
//             {start: 10, end: 13, value: '#f6ff00'},
//             {start: 13, end: 15, value: '#ff8a00'},
//             {start: 15, end: 20, value: '#ff0600'},
//         ]
//     }
//     return [];
// }

// function initSplitListContainer(splitList){
//     var container = document.createElement('div');
//     container.style.cssText = "background:#fff; padding: 5px; border: 1px solid #ccc;";
//     var html = '';
//     for (i = 0; i < splitList.length; i++) { 
//         let key = splitList[i];
//         html += '<div style="line-height: 19px;">';
//         html += '<span style="vertical-align: -2px; display: inline-block; width: 30px;height: 19px;background:'+ key[value] +';"></span>';
//         html += '<span style="margin-left: 3px;">' + key[start] + '-' + key[end] + '</span>';
//         html += '</div>';
//     }    
//     container.innerHTML = html;

//     container.style.position = 'absolute';
//     container.style.left = '10px';
//     container.style.bottom = '50px';
//     document.body.appendChild(legend);
// }